<template>
  <view class="name-authentication-box">
    <view class="group-box">
      <uni-list style="padding-bottom: 50rpx">
        <uni-list-item title="实名信息"> </uni-list-item>
        <uni-list-item title="姓名">
          <template v-slot:footer>
            <input
              style="text-align: right"
              class="uni-input"
              placeholder="请输入你的姓名"
              v-model="userName"
            />
          </template>
        </uni-list-item>
        <uni-list-item title="身份证号">
          <template v-slot:footer>
            <input
              style="text-align: right"
              class="uni-input"
              v-model="userNumber"
              placeholder="请输入你的身份证号码"
            />
          </template>
        </uni-list-item>
      </uni-list>
    </view>

    <view class="fixed-btn">
      <view class="btn" @tap="submitForm">提交审核</view>
    </view>
    <view class="reward-box">实名认证后可获得更多权益</view>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { realNameAuth } from "@/api/user/index.js";
import UniListItem from "@/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue";
import UniList from "@/uni_modules/uni-list/components/uni-list/uni-list.vue";
const userName = ref();
const userNumber = ref();
const fileList = ref([]);

const submitForm = async () => {
  const formParams = {
    idCard: userNumber.value,
    realName: userName.value,
  };
  const res = await realNameAuth(formParams);
  const { code, data } = res;
  if (code === 200) {
    await uni.showToast({
      title: "审核成功",
      icon: "success",
      duration: 1000,
    });
    setTimeout(async () => {
      await uni.navigateBack({
        delta: 1,
      });
    }, 1000);
  }
};
function select(e) {
  const tempFilePaths = e.tempFilePaths;
  const imgUrl = tempFilePaths[0];
  uni.uploadFile({
    url: "/ht-user/user/appUpload",
    file: imgUrl,
    name: "file",
    type: "multipart/form-data",
    success: (uploadFileRes) => {
      console.log(uploadFileRes.data);
    },
  });
}
</script>

<style scoped lang="less">
.name-authentication-box {
  .group-box {
  }
  .reward-box {
    font-size: 24rpx;
    font-family: "ali";
    margin: 20rpx 30rpx;
  }
  .comment-box {
    width: 100vw;
    height: 120rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    position: fixed;
    bottom: 0;
  }
  .fixed-btn {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    width: 100vw;
    height: 125rpx;
    background-color: @color-origin-white;
    padding: 23rpx;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    .btn {
      background-image: linear-gradient(to right, #ff934c, #fc686f);
      width: 90vw;
      height: 80rpx;
      border-radius: 50rpx;
      text-align: center;
      line-height: 80rpx;
      color: #ffffff;
      font-family: "ali-m";
      font-size: 32rpx;
    }
  }
}
</style>
